package com.demo.cms.dao.impl;

import java.util.List;
import java.util.Map;

import com.demo.cms.dao.ArticleCommentDao;
import com.demo.cms.model.ArticleComment;
import com.demo.core.dao.impl.base.PageCoreDaoSupport;
import com.demo.core.model.support.GeneralExecuteModel;

/**
 * 文章评论数据访问实现类
 * 
 * @author ryuu.kk
 *
 */
public class ArticleCommentDaoImpl extends PageCoreDaoSupport<ArticleComment, Long> implements ArticleCommentDao {

	/**
	 * 配置空间 
	 */
	protected final static String AREA_SPACE = "articleCommentSpace.";
	
	/**
	 * 模型表名
	 */
	protected final static String TABLE_NAME = "T_CMS_ARTICLE_COMMENT";
	
	/**
	 * 模型表主键ID
	 */
	protected final static String TABLE_PK_NAME = "ID";
	
	@Override
	public int updateStep(ArticleComment articleComment, Map<String, Object> params) {
		params.put("articleComment", articleComment);
		return getSqlMapClientTemplate().update(nameSpace() + "updateStep", params);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<ArticleComment> tree(Map<String, Object> params) {
		return getSqlMapClientTemplate().queryForList(model.getNameSpace() + "queryTree", params);
	}
	@Override
	protected String nameSpace() {
		return AREA_SPACE;
	}

	@Override
	protected void doInit(GeneralExecuteModel<Long> model) {
		model.setTable(TABLE_NAME);
		model.setPk(TABLE_PK_NAME);
		model.setNameSpace(AREA_SPACE);
	}
}
